<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function Father(uname, age, gender) {
            // console.log(this);
            this.uname = uname
            this.age = age
            this.gender = gender
        }
        // 继承方法
        Father.prototype.money = function () {
            console.log('赚了一个小目标')
        }
     
        // 继承属性
        function Son(uname, age, gender){
            // console.log(this);
            Father.call(this,uname, age, gender)
        }
       
        
        // console.log(son);
        const father=new Father('猪爸爸',6,'男')
        Son.prototype=new Father()
        Son.prototype.constructor=Son
        Son.prototype.smoke=function(){
            console.log(this);
            console.log('抽烟');
        }
        // Son.prototype.constructor = Son
        // 在创建前该原型指向
        console.log(Son.prototype.__proto__);
        const son=new Son('乔治',2.5,'男')
        son.money()
        father.money()
        son.smoke()
        father.smoke()

        
        // console.log(father);
    </script>
</body>

</html>